#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "qavplayer.h"
#include "qavvideoframe.h"
#include "qavaudiooutput.h"

#include <QMainWindow>
#include <QSlider>
#include <QFrame>

class VideoRenderWidget;
class VideoPlayer;
class ArrowRectangle;
class QPushButton;
class QLabel;
class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget* parent = nullptr);
    ~MainWindow() override;

    void initContent();

    void initFloatWidget();

    void initConnection();

private:
    QString formatTime(int s);

protected:
    void resizeEvent(QResizeEvent* event) override;
    void leaveEvent(QEvent* event) override;
    void enterEvent(QEvent* event) override;

signals:

public slots:
    void openFile();
    void playAudio(const QAVAudioFrame &frame);
    void playVideo(const QAVVideoFrame &frame);

private:
    VideoRenderWidget* m_videoRenderWidget = Q_NULLPTR;
    QFrame* m_floatingWidget = Q_NULLPTR;
    QSlider* m_slider = Q_NULLPTR;
    QWidget* m_buttonBox = Q_NULLPTR;
    ArrowRectangle* m_arrowRectangle = Q_NULLPTR;
    QPushButton* m_volumeButton = Q_NULLPTR;
    QAVAudioOutput m_audioOutput;
    QAVPlayer m_player;
    QLabel* m_totalLabel = nullptr;
    QLabel* m_label = nullptr;
};

#endif // MAINWINDOW_H
